<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <title>title</title>
    <link rel="stylesheet" type="text/css" href="../../css/aui.css" />
    <style>
        body {}
    </style>
</head>

<body>
    <div class="aui-tab" id="menu">
        <div class="aui-tab-item aui-active" tapmode onclick="fnSetFrameGroupIndex(0);">官方通知</div>
        <div class="aui-tab-item " tapmode onclick="fnSetFrameGroupIndex(1);">订单消息</div>
    </div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript">
    apiready = function() {
        menus = $api.domAll($api.byId('menu'), '.aui-tab-item');
        var frame_list = new Array();
        frame_list[0] = {
            name: 'index_msg_' + 0,
            url: 'widget://html/my/usermsg_tz.html',
            pageParam: {key:'tongzhi'},
            bounces: false,
            allowEdit: true,
        };
        frame_list[1] = {
            name: 'index_msg_' + 1,
            url: 'widget://html/my/usermsg_tz.html',
            pageParam: {key:'xiaoxi'},
            bounces: false,
            allowEdit: true,
        };
        api.openFrameGroup({
            name: 'index_msg_list',
            scrollEnabled: true,
            rect: {
                marginTop:api.pageParam.headerH+48,
                marginLeft: 0,
                marginRight: 0,
                marginBottom: 0
            },
            fixedOn: 'ui_layout',
            index: 0,
            preload: 1,
            frames: frame_list
        }, function(ret, err) {
            fnSetNavMenuSelected(ret.index);
        });
    };

    function fnSetFrameGroupIndex(index_) {
        fnSetNavMenuSelected(index_);
        api.setFrameGroupIndex({
            name: 'index_msg_list',
            index: index_,
            scroll: true
        });
    }

    function fnSetNavMenuSelected(index_) {
        for (var i = 0; i < menus.length; i++) {
            if (index_ == i) {
                $api.addCls(menus[i], 'aui-active');
            } else {
                $api.removeCls(menus[i], 'aui-active');
            }
        }
    }
</script>

</html>
